#ifndef FILE_BASE_H
#define FILE_BASE_H

#include <cstdio>
#include <string>


///
/// \class FileBase filebase.h "include\file\filebase.h"
/// \brief A base class providing common functionality for files.
///
/// \details FileBase serves as a base from which InFile and OutFile classes
/// inherit. It provides an easier way of manipulating C-style files since the 
/// stadard C++ file streams could not be used. Should they be available, the 
/// standard file streams should be used throughout the program instead. This
/// class was written to partly resemble the standard file streams as to 
/// facilitate the transition.
///

class FileBase
{
  public:
	enum OpenMode {
		app, in, out,
		OPEN_MODE_SIZE
	};

	enum Position {
		beg = SEEK_SET, cur = SEEK_CUR, end = SEEK_END,
		POSITION_SIZE
	};

	FileBase();
	~FileBase();

	void close();
	bool is_open();
  
  protected:
	FILE* file_;

	void open_as(std::string path, OpenMode);

};

#endif // FILE_BASE_H
